package com.mvc.service.impl;


import com.jfinal.plugin.activerecord.Page;
import com.mvc.model.Tribute;
import com.mvc.request.ReqTributePage;
import com.mvc.request.ReqVenueTribute;
import com.mvc.request.ReturnData;
import com.mvc.response.RspPage;
import com.mvc.service.TributeService;

/***
 * 祭品
 * 
 * @author Swer
 * 
 */
public class TributeServiceImpl implements TributeService {

	/***
	 *  祭品列表【分页】
	 * @param req
	 * @return
	 */
	public ReturnData<RspPage<Tribute>> queryPage(ReqTributePage req)
	{
		Page<Tribute> page = Tribute.dao.getPage(req.getNowPage(), req.getPageSize(),req.getType());
		RspPage<Tribute> rspPage = new RspPage<>();
		rspPage.setNowPage(req.getNowPage());
		rspPage.setTotalPage(page.getTotalPage());
		rspPage.setList(page.getList());
		return new ReturnData<RspPage<Tribute>>(rspPage,200,"OK");
	}

	
	/***
	 *  获取场馆祭品列表【分页】
	 * @param req
	 * @return
	 */
	public ReturnData<RspPage<Tribute>> queryVenuePage(ReqVenueTribute req)
	{

		if (req == null) {
			return new ReturnData<RspPage<Tribute>>(null, 500, "请求参数不完整!");
		}
		
		if (req.getVenueId() <=0 ) {
			return new ReturnData<RspPage<Tribute>>(null, 202, "请选择纪念馆!");
		}
		
		Page<Tribute> page = Tribute.dao.getVenuePage(req.getNowPage(), req.getPageSize(),req.getVenueId());
		RspPage<Tribute> rspPage = new RspPage<>();
		rspPage.setNowPage(req.getNowPage());
		rspPage.setTotalPage(page.getTotalPage());
		rspPage.setList(page.getList());
		return new ReturnData<RspPage<Tribute>>(rspPage,200,"OK");
		
	}
}
